<template>
	<view class="content">
		<!--  -->
		<!-- F5：提交按钮 -->
		<button class="btn" @click="dosetup">退出登录</button>
	</view>
</template>

<script>
import { userLogout } from '../../service/index.js';
export default {
	data() {
		return {};
	},
	methods: {
		async dosetup() {
			uni.showModal({
				title: '提示',
				content: '你确定退出吗',
				success: async function(res) {
					if (res.confirm) {
						let data = await userLogout();
						if (data.code === 2000) {
							uni.redirectTo({
								url: '/pages/login/login'
							});
						}
					} else if (res.cancel) {
						// console.log('用户点击取消');
					}
				}
			});
		}
	}
};
</script>

<style lang="scss">
.btn {
	margin: $uni-spacing-col-lg * 2.5 $uni-spacing-col-lg * 3 0;
	background: $zh-theme-color;
	color: $uni-text-color-inverse;
	font-size: $uni-font-size-base;
}
</style>
